# =================================
# M3G-Viewer project config file.
# =================================

# project info
project (M3G-Viewer)

# required cmake
cmake_minimum_required (VERSION 2.0)


# ==================================
# dependend libraries
# ==================================
find_package (X11    REQUIRED)
find_package (OpenGL REQUIRED)



# ==================================
# precompiled libraries
# ==================================
# メモ：${X11_LIBRARIES}には${X11_Xft_LIB}と${X11_Xinerama_LIB}が含まれているのが妥当だと思うが、
#       cmake-2.8.2/Ubuntuにはなぜか入ってないので明示的に指定している。
set (FLTK_INCLUDE_DIR        ${CMAKE_CURRENT_SOURCE_DIR}/fltk1.3.0/include      )
set (FLTK_LIBRARIES          ${CMAKE_CURRENT_SOURCE_DIR}/fltk1.3.0/lib/libfltk.a
                             ${CMAKE_CURRENT_SOURCE_DIR}/fltk1.3.0/lib/libfltk_gl.a
                             ${CMAKE_CURRENT_SOURCE_DIR}/fltk1.3.0/lib/libfltk_images.a)
set (DESKTOP_M3G_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/desktop-m3g/include    )
set (DESKTOP_M3G_LIBRARIES   ${CMAKE_CURRENT_SOURCE_DIR}/desktop-m3g/lib/linux/libm3g.so)

set (M3G_VIEWER_PRECOMPILED_INCLUDE_DIR ${X11_INCLUDE_DIR}
                                        ${OPENGL_INCLUDE_DIR}
                                        ${FLTK_INCLUDE_DIR}
                                        ${DESKTOP_M3G_INCLUDE_DIR})
set (M3G_VIEWER_PRECOMPILED_LIBRARIES   ${DESKTOP_M3G_LIBRARIES}
                                        ${X11_LIBRARIES}
                                        ${OPENGL_LIBRARIES}
                                        ${X11_Xft_LIB}
                                        ${X11_Xinerama_LIB}
                                        ${FLTK_LIBRARIES})
                                        

# ================================
# Default Build is "Debug"
# ================================
if (NOT CMAKE_BUILD_TYPE)
    message (STATUS "Build type is not specified, then")
    message (STATUS "  set CMAKE_BUILD_TYPE=Debug")
    set (CMAKE_BUILD_TYPE "Debug")
endif (NOT CMAKE_BUILD_TYPE)
message (STATUS "Configuring m3g-viewer for ${CMAKE_BUILD_TYPE}...")

# for "Debug"
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
    message (STATUS "  set CMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/bin")
    set (CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/bin)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")

# for "Release"
if  (CMAKE_BUILD_TYPE STREQUAL "Release")
    # nothing
endif (CMAKE_BUILD_TYPE STREQUAL "Release")


# =============================
# project src
# =============================
#add_subdirectory (fltk1.3.0)
#add_subdirectory (desktop-m3g)
add_subdirectory (m3g-viewer)



# ================================
# Confirm current configuration
# ================================
# message (STATUS "Generating Config.hpp ...")


